#ifndef MONITER_H
#define MONITER_H

#include <QWidget>
#include "serialthread.h"
#include "protocol.h"
#include <QTimer>

namespace Ui {
class Monitor;
}

class Monitor : public QWidget
{
    Q_OBJECT

public slots:
    void slotWarnInfo(int flag);
    void slotModeInfo(int flag);
    void slotBeepStatu(bool on);
    void slotTempValue(int flag, QString value);
    void slotHumiValue(int flag, QString value);
    void slotShowRecvData(QByteArray ba);

public:
    explicit Monitor(QWidget *parent = 0);
    ~Monitor();

private:
    Ui::Monitor *ui;

    Protocol m_protocol;
    SerialThread *m_serial;

    QTimer *m_tempTimer;
    QTimer *m_humiTimer;
    QTimer *m_tipsTimer;

private slots:
    void slotTimeOutTemp(void);
    void slotTimeOutHumi(void);
    void slotTimeOutTips(void);

    void on_pb_openSerial_clicked();
    void on_pb_send_clicked();
    void on_pb_beep_clicked();
    void on_pb_clearRecvWidget_clicked();
    void on_pb_tempStart_clicked();
    void on_pb_humiStart_clicked();
    void on_pb_tempMaxVAdd_clicked();
    void on_pb_tempMaxVSub_clicked();
    void on_pb_tempMinVAdd_clicked();
    void on_pb_tempMinVSub_clicked();
    void on_pb_humiMaxVAdd_clicked();
    void on_pb_humiMaxVSub_clicked();
    void on_pb_humiMinVAdd_clicked();
    void on_pb_humiMinVSub_clicked();
    void on_cb_mode_currentIndexChanged(int index);
    void on_pb_tipStart_clicked();
};

#endif // MONITER_H
